﻿using System.Collections.Generic;

namespace Comdiv.QWeb.Utils.LogicalExpressionLanguage {
	public abstract class LogicTermSource : ILogicTermSource {
		#region ILogicTermSource Members

		public abstract string value(string name);

		public abstract IDictionary<string, string> getall();
		public abstract bool get(string name);
		public abstract bool equal(string name, string value);

		#endregion

		public static LogicTermSource Create(string[] array) {
			return Create((IEnumerable<string>) array);
		}

		public static LogicTermSource Create(IEnumerable<string> se) {
			var dict = new Dictionary<string, string>();
			foreach (var e in se) {
				dict[e] = e;
			}
			return Create(dict);
		}

		public static LogicTermSource Create(IDictionary<string, string> dict) {
			return new DictionaryTermSource(dict);
		}
	}
}